import React, { useEffect, useState } from "react";
import {
    MoreOutlined,
    PayCircleOutlined
} from '@ant-design/icons';
import { http } from "@/utils";
const CardArticleCount = () => {
    const [state, setState] = useState({
        total: 0,
        week: 0,
        month: 0
    })

    const getState = () => {
        http.post({
            url: "/article/list",
            params: {

            },
            before: () => { },
            success: res => {
                setState({
                    total: res.data.total,
                    week: 0,
                    month: 0
                })
            }
        })
    }

    useEffect(() => {
        getState();
    }, [])
    return (
        <>
            <div className="item">
                <div className="item-container">
                    <div className="item-card item-header">
                        <span className="item-title">文章数量</span>
                        <MoreOutlined />
                    </div>
                    <div className="item-card item-word" >
                        <span className="icon">
                            <PayCircleOutlined />
                        </span>
                        <span className="amount">{state.total}</span>
                    </div>
                    <div className="item-card title2">
                    </div>
                    <div className="item-card tips">
                        <span>本周 {state.week}</span>
                        <span>本月 {state.month}</span>
                    </div>
                </div>
            </div>
        </>
    )
}
export default CardArticleCount;